﻿/*  
 *  IIS LogFile Analyser, Copyright (C) 2013. http://www.iis-analyser.com
 *  --
 *  This program is free software, provided "AS IS" WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 * 
 *  File Author: Ian Quigley,    2013-02-23
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace Web
{
    public partial class Schema : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            StringBuilder html = new StringBuilder();

            foreach (var table in DataStore.Schema.Get.OrderByDescending(t => t.Fields.Count))
            {
                html.AppendFormat("<h5>{0}</h5>", table.Table.Name);
                html.AppendFormat("<ul>");
                foreach (var field in table.Fields)
                {
                    html.AppendFormat("<li>{0} - {1}</li>", field.SqlColumnName, field.Description);
                
                }
                html.AppendFormat("</ul>");
            }

            litSchema.Text = html.ToString();
        }
    }
}